/**
 * Created by Administrator on 15-10-9.
 */
window.onload=function(){
    var url = getUrl();
    //旅游新闻
    $.jsonp({
        url: 'http://'+url+'/api/recommend/news/3',
        data: {type:3},
        callbackParameter: "callback",
        success: function (data, textStatus, xOptions) {
            var len = data.arrays.length-1;
            var html ='<img src="'+data.arrays[len].photos+'" alt="">'+
                '<h3>'+data.arrays[len].caption+'</h3>';
            $("#new_tpl").html(html);
        },
        error: function (xOptions, textStatus) {}
    });
    //景点介绍
    $.jsonp({
        url: 'http://'+url+'/api/recommend/spots/list',
        data: {},
        callbackParameter: "callback",
        success: function (data, textStatus, xOptions) {

            var len = data.arrays.length-1;
            var html ='<img src="'+data.arrays[len].photos+'" alt="">'+
                '<h3>'+data.arrays[len].spotsName+'</h3>';
            $("#spot_tpl").html(html);
        },
        error: function (xOptions, textStatus) {}
    });
    //特色推荐
    $.jsonp({
        url: 'http://'+url+'/api/recommend/shops/6/list',
        data: {type:6},
        callbackParameter: "callback",
        success: function (data, textStatus, xOptions) {
            var len = data.arrays.length-1;
            var html ='<img src="'+data.arrays[len].photos+'" alt="">'+
                '<h3>'+data.arrays[len].shopName+'</h3>';
            $("#special_tpl").html(html);
        },
        error: function (xOptions, textStatus) {}
    });
    //自驾车必看
    $.jsonp({
        url: 'http://'+url+'/api/recommend/news/2',
        data: {type:2},
        callbackParameter: "callback",
        success: function (data, textStatus, xOptions) {
            var len = data.arrays.length-1;
            var html ='<img src="'+data.arrays[len].photos+'" alt="">'+
                '<h3>'+data.arrays[len].caption+'</h3>';
            $("#drive_tpl").html(html);
        },
        error: function (xOptions, textStatus) {}
    });
}